*contains a program that disseminates (country)stocks across two variables

cap program drop splevelup
program splevelup
	version 11
	syntax varlist, from(varlist) to(varlist)

	levelsof `from'
	local levels `r(levels)'
	local vlab : value label `from'
	foreach var of local varlist {
		foreach level of local levels {
			local lab : label `vlab' `level'
			gen _`var'_`lab' = .
			replace _`var'_`lab' = `var' if `from' == `level'
			bysort `to' : egen `var'_`lab' = min(_`var'_`lab')
			drop _`var'_`lab'
		}
	}
end program